/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.generator.command;

import ru.jSkyRoom.factory.LeveledEntryFactory;
import ru.jSkyRoom.interfaces.major.LeveledItemList;
import ru.jSkyRoom.interfaces.major.Major;
import ru.jSkyRoom.interfaces.sub.JSkyLeveledEntry;

/**
 *
 * @author Rakev
 */
public class LeveledItemDistributionCommand<T extends Major> implements Command<T> {

    private LeveledItemList levelList;
    private int level;
    private int number;

    public LeveledItemDistributionCommand(LeveledItemList levelList, int level, int number) {
        this.levelList = levelList;
        this.level = level;
        this.number = number;
    }

    @Override
    public T apply(T item) {
        JSkyLeveledEntry leveledEntry = LeveledEntryFactory.create().create(item, level, number);
        levelList.addEntry(leveledEntry);
        return item;
    }
}
